FROM node:10 AS builder

WORKDIR /wonders-pathology-pages
COPY package.json ./

RUN npm install && npm install nodemon -g && npm install --save os-homedir
COPY . .
RUN npm run build

FROM node:lts-alpine
ENV NODE_ENV production
WORKDIR /wonders-pathology-pages
COPY --from=builder /wonders-pathology-pages/node_modules ./node_modules
COPY --from=builder /wonders-pathology-pages/dist ./
COPY --from=builder /wonders-pathology-pages/dist ./dist

CMD ["./node_modules/nodemon/bin/nodemon.js", "index.js"]
